home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / ANGLES.dxr / 00194_Move the Angle Rau.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.3 KB  |  41 lines

  1. property theta
  2.  
  3. on beginSprite me
  4.   set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
  5.   set theta to 45
  6. end
  7.  
  8. on endSprite me
  9.   set the cursor of sprite the spriteNum of me to 0
  10. end
  11.  
  12. on mouseDown me
  13.   set the cursor of sprite the spriteNum of me to [member "Closed hand", member "Closed Hand Mask"]
  14.   repeat while the stillDown
  15.     clear(member "DAngle")
  16.     set angle to PointToVector(member "DAngle", 174, 174, the mouseH - 31, the mouseV - 32)
  17.     set theta to the locH of angle
  18.     if theta >= 360 then
  19.       set theta to theta - 360
  20.     else
  21.       if theta < 0 then
  22.         set theta to theta + 360
  23.       end if
  24.     end if
  25.     put theta into field "theta"
  26.     set endP to VectorToPoint(member "DAngle", 174, 174, theta, 175)
  27.     if the machineType < 256 then
  28.       SetForeColor(member "DAngle", 255, 0, 255)
  29.       DrawFilledWedge(member "DAngle", 142, 144, 208, 210, 0, theta)
  30.     end if
  31.     SetForeColor(member "DAngle", 0, 0, 255)
  32.     DrawSingleArrow(member "DAngle", 174, 174, the locH of endP, the locV of endP)
  33.     Redraw(member "DAngle")
  34.     sendSprite(32, #move, theta)
  35.     updateStage()
  36.   end repeat
  37.   drawLine(the spriteNum of me, 207, 206, the locV of endP + 32, the locH of endP + 31)
  38.   set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
  39.   updateStage()
  40. end
  41.